home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WWTCLKit / WWButton.m < prev    next >
Encoding:
Text File  |  1995-03-22  |  2.9 KB  |  122 lines

  1.  
  2. #import "WWButton.h"
  3. #import "WWButtonCell.h"
  4.  
  5. #import "avoidStupidWarnings.h"
  6.  
  7. @implementation WWButton
  8.  
  9. static id myStoredCellClass;
  10.  
  11.  
  12. + initialize 
  13.   [WWButton setVersion:1]; 
  14.  
  15.   if (self == [WWButton class])
  16.   {  myStoredCellClass = [WWButtonCell class];
  17.   }
  18.  
  19.   return self; 
  20. }
  21. //
  22. + setCellClass:classID
  23. {
  24.   myStoredCellClass = classID;
  25.   return self;
  26. }
  27. ////////////////////////////////////////////////////////
  28. - initFrame:(const NXRect *)frameRect icon:(const char *)aString tag:(int)anInt target:anObject action:(SEL)aSelector key:(unsigned short)charCode enabled:(BOOL)flag
  29. {
  30.   id  oldCell;
  31.  
  32.  
  33.   [super initFrame:frameRect icon:aString tag:anInt target:anObject action:aSelector key:charCode enabled:flag];
  34.   oldCell = [self setCell:[[WWButtonCell alloc] init]];
  35.   [oldCell free];
  36.   return self;
  37. }
  38. //
  39. - initFrame:(const NXRect *)frameRect title:(const char *)aString tag:(int)anInt target:anObject action:(SEL)aSelector key:(unsigned short)charCode enabled:(BOOL)flag
  40. {
  41.   id  oldCell;
  42.  
  43.  
  44.   [super initFrame:frameRect title:aString tag:anInt target:anObject action:aSelector key:charCode enabled:flag];
  45.   oldCell = [self setCell:[[myStoredCellClass alloc] init]];
  46.   [oldCell free];
  47.   return self;
  48. }
  49. //
  50. - init
  51. {
  52.   id  oldCell;
  53.  
  54.  
  55.   [super init];
  56.   oldCell = [self setCell:[[myStoredCellClass alloc] init]];
  57.   [oldCell free];
  58.   return self;
  59. }
  60.  
  61. // need to be able to see the cell's tclVar...
  62. - setTclVar:(const char *)str { return [[self cell] setTclVar:str]; }
  63. - (const char *)tclVar { return [[self cell] tclVar]; }
  64.  
  65. // need to be able to see the cell's controlString...
  66. - setControlString:(const char *)str { return [[self cell] setControlString:str]; }
  67. - (const char *)controlString { return [[self cell] controlString]; }
  68.  
  69. // need to be able to see the cell's tclExpression...
  70. - setTclExpression:(const char *)str { return [[self cell] setTclExpression:str]; }
  71. - (const char *)tclExpression { return [[self cell] tclExpression]; }
  72.  
  73. // need to be able to see the cell's tclExpression...
  74. - setTclCommand:(const char *)str { return [[self cell] setTclCommand:str]; }
  75. - (const char *)tclCommand { return [[self cell] tclCommand]; }
  76.  
  77. - setInterp:newInterp {  return [[self cell] setInterp:newInterp]; }
  78. - evaluateSelf { return [[self cell] evaluateSelf]; }
  79.  
  80. - sendAction:(SEL)theAction to:theTarget
  81. {
  82.   if ([cell respondsTo:@selector(updateInterp)])
  83.   {  [cell updateInterp];
  84.   }
  85.  
  86.   return [super sendAction:theAction to:theTarget];
  87. }
  88.  
  89. // IB stuff
  90. - (const char *)getInspectorClassName 
  91. {  
  92.    NXEvent  *event = [NXApp currentEvent];
  93.  
  94.    if (event->flags & NX_ALTERNATEMASK)
  95.    {  return [super getInspectorClassName];
  96.    }
  97.    
  98.    return "WWButtonIBInspector"; 
  99. }
  100.  
  101. - write:(NXTypedStream *)stream 
  102. {
  103.    [super write:stream];
  104.    return self;
  105. }
  106. //
  107. - read:(NXTypedStream *)stream 
  108. {
  109.    int version;
  110.  
  111.    [super read:stream];
  112.  
  113.    version = NXTypedStreamClassVersion(stream, "WWButton");
  114.    if (version == 1)
  115.    {  
  116.    }
  117.    return self;
  118. }
  119.  
  120. @end
  121.